<?php

define('IN_SEXMALL', true);

require(dirname(__FILE__) . '/includes/init.php');


/* act操作项的初始化 */
if (empty($_REQUEST['act']))
{
	$_REQUEST['act'] = 'edit';
}
else
{
	$_REQUEST['act'] = trim($_REQUEST['act']);
}


if ($_REQUEST['act'] == 'edit')
{
	admin_priv('keyword_filter');

	/* 获取广告数据 */
	$sql = "SELECT id,string FROM " .TABLEPRE. "stringfilter LIMIT 1 ";
	$keyword = $db->getRow($sql);

	$smarty->assign('ur_here',       '过滤关键字');
	$smarty->assign('form_act',      'update');
	$smarty->assign('keyword',     $keyword);

	$smarty->assign('full_page',   1);
	$smarty->display('keyword_filter.htm');
}

/*------------------------------------------------------ */
//-- 编辑的处理
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'update')
{
	admin_priv('keyword_filter');

	/* 初始化变量 */
	$id   = !empty($_POST['id']) ? intval($_POST['id']) : 0;

	$string   = !empty($_POST['string']) ? trim($_POST['string']) : '';

	/* 更新信息 */
	$sql = "UPDATE " .TABLEPRE. "stringfilter SET string = '$string' ".
            "WHERE id = '$id'";
	$db->query($sql);

	/* 记录管理员操作 */
	admin_log($string, 'edit', 'stringfilter');

	clear_cache_files(); // 清除模版缓存

	/* 提示信息 */
	$href[] = array('text' => '返回', 'href' => 'keyword_filter.php?act=edit');
	sys_msg($_LANG['edit'] . $_LANG['attradd_succed'], 0, $href);

}




?>